package com.iss.springdemo1.mvc.controller;

import com.iss.springdemo1.mvc.model.Employee;
import com.iss.springdemo1.mvc.model.ResponseMessage;
import com.iss.springdemo1.mvc.model.User;
import com.iss.springdemo1.mvc.service.UserService;
import com.iss.springdemo1.mvc.service.UserService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class EmployeeController {

    @Autowired
    private UserService userService;

    @Autowired
    private UserService2 userService2;

    @RequestMapping(value = "login")
    @ResponseBody
    public Boolean msg(String username){
        /*
         * 1. 参数列表上的 数据 来自request
         * 通过自动装载 传给 username
         * 2. return 之后的值 被转化成json或者字符串
         *  传给 response 返回到 浏览器
        * */
       return  userService.login(username);
    }

    @RequestMapping("login2")
    @ResponseBody
    public ResponseMessage login2(User user){
        return     userService2.login(user);
    }


}
